﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Poem.Core.Entities;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;

namespace Poem.Application.Test.Data
{
    public class PoetTestDataSeed : IDataSeedContributor, ITransientDependency
    {
        private readonly IRepository<Poet, int> _appPoet;

        public PoetTestDataSeed(IRepository<Poet, int> appPoet)
        {
            _appPoet = appPoet;
        }

        public Task SeedAsync(DataSeedContext context)
        {
            _appPoet.InsertAsync(new Poet
            {
                Name = "李白",
                Description = "诗人"
            }, true);
            _appPoet.InsertAsync(new Poet
            {
                Name = "杜甫",
                Description = "诗人"
            }, true);

            return Task.CompletedTask;
        }
    }
}
